Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make limit on number of expanded fields configurable #35284

Merged
merged 4 commits into from
Nov 8, 2018

Conversation

cbuescher
Copy link
Member

Currently we introduced a hard limit of 1024 to the number of fields a query can
be expanded to in #26541. Instead of using a hard limit, we should make this
configurable. This change removes the hard limit check and uses the existing
max_clause_count setting instead.

Closes #34778

Currently we introduced a hard limit of 1024 to the number of fields a query can
be expanded to in elastic#26541. Instead of using a hard limit, we should make this
configurable. This change removes the hard limit check and uses the existing
`max_clause_count` setting instead.

Closes elastic#34778
@cbuescher cbuescher added >enhancement :Search/Search Search-related issues that do not fall into other categories v7.0.0 labels Nov 6, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

Copy link
Member Author

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realize that indices.query.bool.max_clause_count isn't dynamically updateable, I don't know if we touched that point in our discussion that led to reusing this setting for the limit for the expansion of fields as well. Just would like to make whoever reviews this aware of this and ask for their opinion.

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cbuescher . I left some comments.

I just realize that indices.query.bool.max_clause_count isn't dynamically updateable

I think it's fine. I am not even sure that we should document this extensively. Querying more than 1024 fields is an anti-pattern so new users don't need to be aware of this.

at once.
the metadata fields. There is a limit on the number of fields that can be queried
at once which is defined by the `indices.query.bool.max_clause_count` <<search-settings>>
which defaults to 1024.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a note in the multi_match query ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np


@BeforeClass
public static void createRandomClusterSetting() {
CLUSTER_MAX_CLAUSE_COUNT = randomIntBetween(500, 1500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test with small numbers, this seems big for a simple ut.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, the test was running with the default of 1024 before, so I wanted to stay in that area but there's no need to. Will lower it to the hundreds if that sounds okay.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@colings86 colings86 added :Search/Search Search-related issues that do not fall into other categories and removed :Search/Search Search-related issues that do not fall into other categories labels Nov 6, 2018
@cbuescher
Copy link
Member Author

@jimczi thanks for the first round of reviews, I pushed an update

cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Nov 6, 2018
With elastic#35284 changing the limit on the amount of fields that a query can be
expanded to to be determined by the `indices.query.bool.max_clause_count`
setting, the changes the deprecation warning and docs in 6.x accordingly.

Relates to elastic#35284
cbuescher pushed a commit that referenced this pull request Nov 8, 2018
With #35284 changing the limit on the amount of fields that a query can be
expanded to to be determined by the `indices.query.bool.max_clause_count`
setting, the changes the deprecation warning and docs in 6.x accordingly.

Relates to #35284
Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @cbuescher

@cbuescher cbuescher merged commit 113af79 into elastic:master Nov 8, 2018
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
ppf2 added a commit that referenced this pull request Aug 13, 2020
>Limiting the number of auto-expanded fieldsedit
Executing queries that use automatic expansion of fields (e.g. query_string, simple_query_string or multi_match) can have performance issues for indices with a large numbers of fields. To safeguard against this, a hard limit of 1024 fields has been introduced for queries using the "all fields" mode ("default_field": "") or other fieldname expansions (e.g. "foo").

Per #35284, it looks like we changed this from a hard limit to a soft limit by leveraging `indices.query.bool.max_clause_count` in 7.0 beta1.  We will want to backport this to all 7.x versions.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
jrodewig pushed a commit that referenced this pull request Aug 18, 2020
Per #35284, it looks like we changed this from a max field expansions limit to a soft limit using the `indices.query.bool.max_clause_count` dynamic cluster settting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants